(function($){





	$.fn.Slide=function(options){





		var opts = $.extend({},$.fn.Slide.deflunt,options);





		var index=1;





		var targetLi = $("." + opts.claNav + " li", $(this));//目标对象





		var clickNext = $("." + opts.claNav + " .next", $(this));//点击下一个按钮





		var clickPrev = $("." + opts.claNav + " .prev", $(this));//点击上一个按钮





		var ContentBox = $("." + opts.claCon , $(this));//滚动的对象





		var ContentBoxNum=ContentBox.children().size();//滚动对象的子元素个数





		var slideH=ContentBox.children().first().height();//滚动对象的子元素个数高度，相当于滚动的高度





		var slideW=ContentBox.children().first().width();//滚动对象的子元素宽度，相当于滚动的宽度





		var autoPlay;





		var slideWH;





		if(opts.effect=="scroolY"||opts.effect=="scroolTxt"){





			slideWH=slideH;





		}else if(opts.effect=="scroolX"||opts.effect=="scroolLoop"){





			ContentBox.css("width",ContentBoxNum*slideW);





			slideWH=slideW;





		}else if(opts.effect=="fade"){





			ContentBox.children().first().css("z-index","1");





		}





		





		return this.each(function() {





			var $this=$(this);





			//滚动函数





			var doPlay=function(){





				$.fn.Slide.effect[opts.effect](ContentBox, targetLi, index, slideWH, opts);





				index++;





				if (index*opts.steps >= ContentBoxNum) {





					index = 0;





				}





			};





			clickNext.click(function(event){





				$.fn.Slide.effectLoop.scroolLeft(ContentBox, targetLi, index, slideWH, opts,function(){





					for(var i=0;i<opts.steps;i++){





	                    ContentBox.find("li:first",$this).appendTo(ContentBox);





	                }





	                ContentBox.css({"left":"0"});





				});





				event.preventDefault();





			});





			clickPrev.click(function(event){





				for(var i=0;i<opts.steps;i++){





	                ContentBox.find("li:last").prependTo(ContentBox);





	            }





	          	ContentBox.css({"left":-index*opts.steps*slideW});





				$.fn.Slide.effectLoop.scroolRight(ContentBox, targetLi, index, slideWH, opts);





				event.preventDefault();





			});





			//自动播放





			if (opts.autoPlay) {





				autoPlay = setInterval(doPlay, opts.timer);





				ContentBox.hover(function(){





					if(autoPlay){





						clearInterval(autoPlay);





					}





				},function(){





					if(autoPlay){





						clearInterval(autoPlay);





					}





					autoPlay=setInterval(doPlay, opts.timer);





				});





			}





			





			//目标事件





			targetLi.hover(function(){





				if(autoPlay){





					clearInterval(autoPlay);





				}





				index=targetLi.index(this);





				window.setTimeout(function(){$.fn.Slide.effect[opts.effect](ContentBox, targetLi, index, slideWH, opts);},200);





				





			},function(){





				if(autoPlay){





					clearInterval(autoPlay);





				}





				autoPlay = setInterval(doPlay, opts.timer);





			});





    	});





	};





	$.fn.Slide.deflunt={





		effect : "scroolY",





		autoPlay:true,





		speed : "normal",





		timer : 1000,





		defIndex : 0,





		claNav:"JQ-slide-nav",





		claCon:"JQ-slide-content",





		steps:1





	};





	$.fn.Slide.effectLoop={





		scroolLeft:function(contentObj,navObj,i,slideW,opts,callback){





			contentObj.animate({"left":-i*opts.steps*slideW},opts.speed,callback);





			if (navObj) {





				navObj.eq(i).addClass("on").siblings().removeClass("on");





			}





		},





		





		scroolRight:function(contentObj,navObj,i,slideW,opts,callback){





			contentObj.stop().animate({"left":0},opts.speed,callback);





			





		}





	}





	$.fn.Slide.effect={





		fade:function(contentObj,navObj,i,slideW,opts){





			contentObj.children().eq(i).stop().animate({opacity:1},opts.speed).css({"z-index": "1"}).siblings().animate({opacity: 0},opts.speed).css({"z-index":"0"});





			navObj.eq(i).addClass("on").siblings().removeClass("on");





		},





		scroolTxt:function(contentObj,undefined,i,slideH,opts){





			//alert(i*opts.steps*slideH);





			contentObj.animate({"margin-top":-opts.steps*slideH},opts.speed,function(){





                for( var j=0;j<opts.steps;j++){





                	contentObj.find("li:first").appendTo(contentObj);





                }





                contentObj.css({"margin-top":"0"});





            });





		},





		scroolX:function(contentObj,navObj,i,slideW,opts,callback){





			contentObj.stop().animate({"left":-i*opts.steps*slideW},opts.speed,callback);





			if (navObj) {





				navObj.eq(i).addClass("on").siblings().removeClass("on");





			}





		},





		scroolY:function(contentObj,navObj,i,slideH,opts){





			contentObj.stop().animate({"top":-i*opts.steps*slideH},opts.speed);





			if (navObj) {





				navObj.eq(i).addClass("on").siblings().removeClass("on");





			}





		}





	};





})(jQuery);





$(document).ready(function() {





	function tab1(o1,o2,c,e){





		o1.each(function(i){





			$(this).bind(e,function(){





				o2.hide().eq(i).show();





				o1.removeClass(c);





				$(this).addClass(c);





			})





			if ($(this).hasClass(c)) {





				$(this).addClass(c);





				o2.hide().eq(i).show();





			}





		})





	}





	function tab2(o1,o2,c,t1,t2,a,b){





		var count=o1.size()-1;





		var now;





		var TimeInterval;





		o1.each(function(i){





			$(this).mouseover(function(){





				o2.hide().eq(i).show();





				o1.removeClass(c);





				$(this).addClass(c);





				window.clearInterval(TimeInterval);





			}).mouseout(function(){





				now = i+1;





				TimeInterval = window.setInterval(changeimage,t1);





			});





			if ($(this).hasClass(c)) {





				$(this).addClass(c);





				o2.hide().eq(i).show();





				now = i+1;





			}





		})





		o2.each(function(i){





			$(this).mouseover(function(){





				window.clearInterval(TimeInterval);





			}).mouseout(function(){





				TimeInterval = window.setInterval(changeimage,t1);





			});





		})





		TimeInterval = window.setInterval(changeimage,t1);





		function changeimage(){





			if(now>count)now=0;





			o2.hide().eq(now).stop().fadeTo(0,a).fadeTo(t2,b);





			o1.removeClass(c).eq(now).addClass(c);





			now++;





		}





	}





	//调用函数





	tab1($(".rmd ul li"),$(".rmd img"),"on","mouseover"); //自动切换





	tab1($(".tab li"),$(".box3 > #body1"),"on","mouseover"); //自动切换





	tab2($(".num ul li"),$(".imgs li"),"on",5000,2000,0.6,1); //自动切换





	tab2($(".tnum ul li"),$(".timgs li"),"on",5000,2000,0.6,1); //自动切换


    tab2($(".fnum ul li"),$(".fimgs li"),"on",5000,2000,0.6,1); //自动切换



	tab2($(".snum ul li"),$(".simgs li"),"on",5000,2000,0.6,1); //自动切换





	tab2($(".tmid_rinum ul li"),$(".tmid_rimg li"),"on",5000,2000,0.6,1); //自动切换





	$('#search_tab li a').each(function(i){





			$(this).click(function(){





				$('#search_tab li a').removeClass('on');





				$(this).addClass('on');





				$('#search_cont input.typeid').val($(this).attr("rel"));





			});





		})





	





});





$(function(){





    var top_game_list_on = false;





    $(".tit").hover(function(){





        $('.g_list').show();





    },function(){





        $('.g_list').hide();





    });





    $(".g_list").hover(function(){





        $('.g_list').show();





    },function(){





        $('.g_list').hide();





    }); 





    $(".header .g_list").hover(function(){





        top_game_list_on = true;





        $(".header .g_list").fadeIn('fast');





    },function(){





        top_game_list_on = false;





        $(".header .g_list").fadeOut('slow');





    });





});











function setHomepage(url){





    if (document.all){





        document.body.style.behavior='url(#default#homepage)';





        document.body.setHomePage(url);





    }else if (window.sidebar){





        if(window.netscape){





            try{  





                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  





            }catch (e) {  





                alert( "抱歉！您的浏览器不支持直接设为首页。\n请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为“true”，点击“加入收藏”后忽略安全提示，即可设置成功。" );  





            }





        } 





        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);





        prefs.setCharPref('browser.startup.homepage',url);





    }





}











function AddFavorite(sURL, sTitle){





    try{





        window.external.addFavorite(sURL, sTitle);





    }catch (e){





        try{





            window.sidebar.addPanel(sTitle, sURL, "");





        }catch (e){





            alert("加入收藏失败，请使用Ctrl+D进行添加");





        }





    }





} 





function addFavorites(){





    var t = window.document.title;





    var u = window.document.location.href;





    if (u.indexOf("&s=fav")){





        u += "&s=fav";





    }





    if (window.sidebar) { // Mozilla Firefox Bookmark





        window.sidebar.addPanel(t, u,"");





    }else if( window.external ) { // IE Favorite





        window.external.AddFavorite( u, t);





    }else if(window.opera && window.print) { // Opera Hotlist





        var elem = document.createElement('a');





        elem.setAttribute('href',u);





        elem.setAttribute('title',t);





        elem.setAttribute('rel','sidebar');





        elem.click();





    }else{





        alert("加入收藏失败，请使用Ctrl+D进行添加");





    }





    return false;





}





$(function(){





    var top_game_list_on = false;





    $(".tit").hover(function(){





        $('.g_list').show();





    },function(){





        $('.g_list').hide();





    });





    $(".g_list").hover(function(){





        $('.g_list').show();





    },function(){





        $('.g_list').hide();





    }); 





    $(".header .g_list").hover(function(){





        top_game_list_on = true;





        $(".header .g_list").fadeIn('fast');





    },function(){





        top_game_list_on = false;





        $(".header .g_list").fadeOut('slow');





    });





});





$(document).ready(function() {





//fill_share





//$('.fill_share').share({ count: 4 });





//$('.no_text').share({ count: 4, hasText: false });





//$('.list_all').share();





 





//minisite





function TabSwitch(hot, container, on_class) {





on_class = on_class || 'on';





var _timeOut = -1;





hot.hover(function() {





var obj = $(this);





_timeOut = setTimeout(function() {





var i = obj.index();





obj.parent().children().not(obj.addClass(on_class)).removeClass(on_class);





container.not($(container.get(i)).show()).hide();





}, 100);





}, function() {





_timeOut = clearTimeout(_timeOut);





});





}





TabSwitch($('.minisite .tabs li'), $('.minisite .switch_body'));





 





//navi bottom





var navifootermore = $('.navi_footer .subs li.more');





var navifootersub = $('.navi_footer .subnav');





navifootermore.hover(function() {





$(this).addClass('hover');





navifootersub.show();





}, function() {





$(this).removeClass('hover');





navifootersub.hide();





});





navifootersub.hover(function() {





navifootermore.mouseenter();





}, function() {





navifootermore.mouseleave();





});





});





